<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"><div id="myApp">
<title>Document</title>
<script type="text/javascript" src="js/vue.min.js"></script> 
<script type="text/javascript" src="js/axios.min.js"></script> 
</head>
<body>
	<h3>v-route路由</h3>
	<h4>{{ message }}</h4>
	<button @click="submit()">按钮</button>
</div>
<script type="text/javascript">
var url = "http://www.baidu.com/";
var myApp = new Vue({
	el:"#myApp",	
	data:{ 
		message:'hello world!'
	},
	methods:{
		submit:function(){
			// 在进行 post 和 get 请求的时候，使用 axios 进行访问
			// 进行 get 请求
            axios.get(url).then(function (response){
				console.log(response);
            }).catch(function(error){
				console.log(error);
            });
            // 进行post 请求            
			axios.post(url,{firstName:'Fred',lastName:'Flintstone'}).then(function (response) {
				console.log(response);
			}).catch(function (error) {
				console.log(error);
            });
		}
	} 
});
</script>
</body>
</html>